Skip to content

[TypeDeclarationDocblocks] Handle crash on next empty array on ClassMethodArrayDocblockParamFromLocalCallsRector#7325

Merged
samsonasik merged 2 commits intomainfrom
crash-next-empty-array
Sep 24, 2025
Merged

[TypeDeclarationDocblocks] Handle crash on next empty array on ClassMethodArrayDocblockParamFromLocalCallsRector#7325
samsonasik merged 2 commits intomainfrom
crash-next-empty-array

Conversation

@samsonasik
Copy link
Member

@samsonasik samsonasik commented Sep 24, 2025

Given the following code:

class NotZeroPosition
{
    public function go()
    {
        $this->run([], ['item1', 'item2']);
    }

    private function run(array $data, array $items)
    {
    }
}

It cause crash:

message": "System error: \"Call to a member function isNull() on null
There was 1 error:

1) Rector\Tests\TypeDeclarationDocblocks\Rector\Class_\ClassMethodArrayDocblockParamFromLocalCallsRector\ClassMethodArrayDocblockParamFromLocalCallsRectorTest::test with data set #10 ('/home/runner/work/rector-src/...hp.inc')
Error: Call to a member function isNull() on null

see https://getrector.com/demo/4e14f065-f5fc-4aa6-87c9-6579a05f4769

This PR fix it.

@samsonasik
Copy link
Member Author

Fixed 🎉 /cc @TomasVotruba

@samsonasik
Copy link
Member Author

All checks have passed 🎉 @TomasVotruba I am merging it ;)

@samsonasik samsonasik enabled auto-merge (squash) September 24, 2025 18:33
@samsonasik samsonasik merged commit d7c7d35 into main Sep 24, 2025
50 checks passed
@samsonasik samsonasik deleted the crash-next-empty-array branch September 24, 2025 18:33
@TomasVotruba
Copy link
Member

Great job 👍

@github-actions
Copy link
Contributor

This pull request has been automatically locked because it has been closed for 150 days. Please open a new PR if you want to continue the work.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 22, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants